package com.ruoyi.common.enums;

/**
 * 呼叫类型枚举
 * @Author qiqi
 * @Date 2022/9/5 9:46
 * @Version 1.0
 */
public enum CrmCdrCallTypeEnum {
    /**
     * 预览外呼
     */
    PREVIEW(4L,"预览外呼"),
    /**
     * 主叫外呼
     */
    CALLER(6L,"主叫外呼"),

    /**
     * 内部外呼
     */
    INNER(9L,"内部外呼");

    private final Long code;
    private final String message;

    CrmCdrCallTypeEnum(Long code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 通过代码获取枚举项
     * @param code
     * @return
     */
    public static CrmCdrCallTypeEnum getByCode(Long code) {
        for (CrmCdrCallTypeEnum le : CrmCdrCallTypeEnum.values()) {
            if (le.getCode().equals(code)) {
                return le;
            }
        }

        return null;
    }

    public static CrmCdrCallTypeEnum getByDesc(String message) {
        for (CrmCdrCallTypeEnum le : CrmCdrCallTypeEnum.values()) {
            if (message.equals(le.getMessage())) {
                return le;
            }
        }
        return null;
    }

    public Long getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }}
